<!-- Template for views -->
<?php html::docType() ?>
<html>
<head>
	<?php html::head() ?>
	
<link href="../css/style.css" rel="stylesheet" type="text/css" />

</head>
<body>
<div id="container">
		<?php
			html::navBar2();
			html::flash();
		?>

	<div id="content">
		<div class="section-title">
			<h1 class="page-name">Venue &#62; View</h1>
		</div>
		

		
		<div class="section" id="main">
			<div class="venue-name2">
				<?php 
			$ratingElem = getRatingElement("offer",$view->venue['id'],round($view->venue["rating"]));
			$venue = $view->venue["name"];
			echo "<span class='venue-name'>$venue</span>&nbsp;&nbsp;$ratingElem";
			
			?>
				<span class="title-sub">Offers by this Venue</span>
			</div>
				<?php 
					if(isset($view->request)){
						echo "<div>Results for: Beer > $view->request['beer_name'], Price > $view->request['price'] and Suburb >". ($view->request['suburb'] == '' ? "Any":$view->request['suburb']) . "</div>";
					}
		$markers="";
		$char=65;
		
		foreach($view->offers as $offer){
			$price = '$'.$offer['price'];
			$ratingElem = getRatingElement("offer",$offer['venue_id'],$offer["rounded_venue_rate"]);
			$repeats = getOfferRepeatDays($offer['repeats']);
			$timeFrom = split(":",$offer["time_from"]);
			$timeFrom = "$timeFrom[0]:$timeFrom[1]";
			$timeTo = split(":",$offer["time_to"]);
			$timeTo = "$timeTo[0]:$timeTo[1]";
			$street=urlencode($offer['street']);
			$suburb=urlencode($offer['suburb_name']);
			$markerLetter = chr($char++);
			$marker = "&markers=color:blue|label:$offer[price]|$offer[street]+$offer[suburb_name]";
			$marker = "&markers=color:blue|label:$markerLetter|$street+$suburb+vic+australia";
//			$marker = "&markers=color:blue|label:$offer[price]|$street+$suburb";
//			$marker = "&markers=icon:http://chart.apis.google.com/chart?chst=d_bubble_icon_text_small&chld=ski|bb|Wheeee!|FFFFFF|000000|$street+$suburb";
			$markers = "$markers $marker";

echo <<<EOB
			<div class="offer-result">
				<div class="offer-price">{$price}</div>
				<div class="offer-size-picture">
            		<img src="../img/beer_sizes/{$offer['size_id']}.gif" height="60"/>
        		</div>
				<div class="offer-details">

					<div class="offer-description">
						<div>
            				<span class="offer-beers">
EOB;
							foreach($offer["beers"] as $beer){
								echo <<<EOB
								<a href="router.php?c=beer&a=get&id={$beer["id"]}">{$beer["name"]}</a>
EOB;
							}
echo <<<EOB
							</span>
		    			</div>
			    		<div>
	            			{$repeats}&nbsp
	        				from: {$timeFrom} to: {$timeTo}
	        				<span style="float:right" class="read-more">Read More</span>
	                    </div>
	                    
	                    <div style="display:none">
           					<div>
           						<b>Vadid From {$offer['date_from']} To {$offer['date_to']}</b>
           					</div> 
           					<div>
           						<b>Details:</b><br/>
           						{$offer['description']}
           					</div>
           				</div>
           				
					</div>
				</div>
				
			</div>
EOB;
		}
echo <<<EOB

	</div>
		<div id="side">
			<div class="section" id="search">
				<div class="section-title">
					<h3>Venue Info</h3>
				</div>
EOB;
				$address = $view->venue["street"].",".$view->venue["suburb"]["name"].",".$view->venue["postcode"]["postcode"].","."vic, Australia";
		$addressEncoded = urlencode($address);
		
echo <<<EOB
<div>
<div>
<br/><b>Address:</b> $address
</div><br/>
<div>
<b>Phone:</b> {$view->venue["phone"]}
</div><br/>

<div>
<b>Email:</b> {$view->venue["email"]}
</div><br/>

<div>
<b>Website:</b> <a class="pagination" href="http://{$view->venue["website"]}" target="_blank">{$view->venue["website"]}</a>
</div><br/><br/>
			</div>
			<div class="section" id="map-side">
				<div class="section-title">
					<h3>Map</h3>
					<span class="title-sub"><a href="#">View Larger Map</a></span>
				</div>
				<div class="offer-list-map">
<img src="http://maps.google.com/maps/api/staticmap?size=300x300&maptype=roadmap
&markers=color:blue|$addressEncoded&sensor=false"/>
            	</div>
			</div>
		</div>
	</div>
	
EOB;
html::footer2();
?>
</div>
</body>
</html>